{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "friendly-companion",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/complex-number-multiplication\n",
    "\n",
    "\n",
    "Runtime: 28 ms, faster than 80.19% of Python3 online submissions for Complex Number Multiplication.\n",
    "Memory Usage: 14.3 MB, less than 54.31% of Python3 online submissions for Complex Number Multiplication.\n",
    "\n",
    "\n",
    "```python\n",
    "class Solution:\n",
    "    def complexNumberMultiply(self, a: str, b: str) -> str:\n",
    "        #6:03\n",
    "        def parse(s):\n",
    "            lists = s.split(\"+\")\n",
    "            A = lists[0]\n",
    "            B = lists[1].replace(\"i\", \"\")\n",
    "            return int(A), int(B)\n",
    "        a1, a2 = parse(a)\n",
    "        b1, b2 = parse(b)\n",
    "        #a1 * b1 + (a1 * b2) + (a2 * b1) + ((a2 * b2)*-1)\n",
    "        return str(a1 * b1 + ((a2 * b2)*(-1))) +\"+\"+ str((a1 * b2) + (a2 * b1)) + \"i\"\n",
    "        #6:11\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "artistic-showcase",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
